import request from "@/utils/request";

//获取所有的商品分类
export function listAllCategory() {
  return request({
    url: "/categories/search",
    method: "post",
    data: {
      current: 1,
      size: 300
    }
  });
}

//新增一条记录
export function addCategory(row) {
  return request({
    url: "/categories",
    method: "post",
    data: row
  });
}

//获取列表数据
export function getCategoryByPage(pageVo) {
  return request({
    url: "/categories/search",
    method: "post",
    data: pageVo
  });
}
// 根据id主键获取单条记录
export function getCategoryById(id) {
  return request({
    url: "/categories/" + id
  });
}
// 根据id主键删除单条记录
export function removeCategoryById(id) {
  return request({
    url: "/categories/" + id,
    method: "delete"
  });
}
// 根据主键id更新指定行的数据
export function updateCategoryById(row) {
  return request({
    url: "/categories/" + row.id,
    method: "update",
    data: row
  });
}
